import unittest
import time
from BeautifulReport import BeautifulReport
from utils.send_email import SendMail

# 获取系统当前时间
now = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))
# 设置报告名称格式
HtmlFile = now + "report.html"
if __name__ == '__main__':
    test_suite = unittest.TestLoader().discover('testsuites')
    runner = BeautifulReport(test_suite)
    runner.report(filename=HtmlFile,description='测试报告', log_path='F:\\C++\\untitled3\\reports')
    mail = SendMail()
    new_report = mail.get_NewReport("F:\\C++\\untitled3\\reports")
    mail.send_Mail(new_report)
